<script setup lang="ts">
import {ref} from "vue";
import {useCounterStore} from "@/stores/SaveUser";
import {Editingdata, Modify} from "@/http/Personal center";

const onClickLeft = () => history.back();
const value = ref('');



const nameone = useCounterStore()

// const nicknameUserInfo = ref({
//     id:482235006186557440,
//     nickname:"",
//     gender:"",
//     birthday:""
// })

function keep() {
    Modify(nameone.gradeUserInfo).then(res => {
        // console.log(res)
        if (res==200){
            nameone.userInfo.nickname = nameone.gradeUserInfo.nickname
        }
    })
}
</script>

<template>
    <div>
        <div class="beijing">
            <van-nav-bar
                    left-text="昵称"
                    left-arrow
                    @click-left="onClickLeft"
            />
            <div>
                <van-cell-group inset>
                    <van-field
                            v-model="nameone.gradeUserInfo.nickname"
                            rows="2"
                            autosize
                            type="textarea"
                            maxlength="20"
                            show-word-limit
                    />
                </van-cell-group>
                <p class="wenz">呢称只支持中文、英文、数字、以及一两个符号</p>
            </div>
            <div class="one">
                <van-button type="primary" id="two" to="/bianjiziliao" @click="keep">保存</van-button>
            </div>

        </div>
    </div>
</template>

<style scoped lang="less">
.beijing {
    background-color: #f4f4f4;
    height: 600px;

    .wenz {
        font-size: 15px;
        margin-left: 16px;
        margin-top: 0;
    }

    :deep(.van-nav-bar__content) {
        background-color: #f4f4f4;
    }

    .one {
        text-align: center;

        #two {
            width: 60%;
        }
    }

}
</style>